<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>新品有戏后台管理</title>
    <link href="__CSS__/boot.css" rel="stylesheet">
    <link href="__STATIC__/layui/css/layui.css" rel="stylesheet">
    <script src="__JS__/jquery.js"></script>
    <script src="__JS__/layer/layer.js"></script>
    <script src="__STATIC__/layui/layui.js"></script>
    <script src="__STATIC__/boot/js/dropdown.js"></script>
    <style>
        th{
            text-align: center;
            vertical-align: middle!important;
        }
    </style>
</head>
<body>
{include file="base/header" /}
<br/>
<div style="width: 300px; float: left">
    <div style="float: left;width: 100px;" >
        <div class="dropdown">
            <button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu2" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                付款模式
                <span class="caret"></span>
            </button>
            <ul class="dropdown-menu" aria-labelledby="dropdownMenu2">
                <li><a href="#" onclick="index()">一件代发</a></li>
                <li><a href="#" onclick="postbusiness()">寄售</a></li>
            </ul>
        </div>
    </div>
    <div >
        <button type="button" onclick="account()" class="btn btn-primary">添加商家</button>
        <button type="button" onclick="product()" class="btn btn-info">添加商品</button>
    </div>
</div>
<div style="float: right; margin-top: 5px;margin-bottom: 5px" class="box-title ">
    <form class="form-inline" action="{:url('index/postbusiness/index')}" method="get">
        <input type="text" name="title" value="<?php if(isset($title)) echo $title ?>" class="form-control" id="exampleInputEmail3" >
        <input type="submit" class="btn btn-default" value="搜索"/>
        <input type="button" onclick="res()" value="全部显示" class="btn btn-default"/>
    </form>
</div>
<table class="layui-table">
    <thead>
    <tr>
        <th>编号</th>
        <th>昵称</th>
        <!--<th>内部账号</th>-->
        <th>账号</th>
        <th>联系人</th>
        <th>联系电话</th>
        <th>银行</th>
        <th>支行</th>
        <th>收款账号</th>
        <th>打款凭证</th>
        <th>操作</th>
    </tr>
    </thead>
    <tbody>
    {foreach $result as $val}
    <tr id="del{$val.id}">
        <td>{$val.id}</td>
        <td>{$val.name}</td>
        <!--<td>{$val.account}</td>-->
        <td>{$val.email}</td>
        <td>{$val.linkman}</td>
        <td>{$val.telephone}</td>
        <td>{$val.bank}</td>
        <td>{$val.branch}</td>
        <td>{$val.paymentaccount}</td>
        <td>
            {if empty($val.prove)}
            未上传
            {else/}
            <img src="__ROOT__\\{$val.prove}"  width="50px" height="50px">
            {/if}
        </td>
        <td>
            <button onclick="del({$val.id})" type="button" class="btn btn-danger btn-xs">删除</button>
            <button onclick="goods({$val.id})" type="button" class="btn btn-primary btn-xs" >查看商品</button>
            <button onclick="order({$val.id})" type="button" class="btn btn-success btn-xs" >查看订单</button>
            <button onclick="prove({$val.id})" type="button" class="btn btn-info btn-xs" >上传付款凭证</button>
            <button onclick="shop({$val.id})" type="button" class="btn btn-warning btn-xs" >合作店</button>
            <button onclick="recordsettlement({$val.id})" type="button" class="btn btn-default btn-xs" >结算记录</button>
            <!--<button onclick="apply({$val.id})" type="button" class="btn btn-link">结算申请</button>-->
        </td>
    </tr>
    {/foreach}
    </tbody>
</table>
{$result->render()}
</body>
<script>
    //查看先付款商家
    function index() {
        window.location.href = "{:url('index/order/index')}";
    }
    //添加商家
    function account() {
        window.location.href = "{:url('index/account/index')}";
    }
    //添加商品
    function product() {
        window.location.href = "{:url('index/product/add')}";
    }
    //删除
    function del(id) {
        layer.confirm('你确定要删除吗',{bnt:['确定','取消']},
            function () {
                $.ajax({
                    url:"{:url('index/postbusiness/delete')}",
                    data:"id="+id,
                    type:"post",
                    dataType:"json",
                    success:function (res) {
                        if(res.success){
                            layer.alert(res.success);
                            $("#del"+id).remove();
                        }
                    }
                });
            }
        );
    }
    //查看商品
    function goods(id) {
        window.location.href = "{:url('index/postbusiness/goods')}?id="+id;
    }
    //查看订单
    function order(id) {
        window.location.href = "{:url('index/postbusiness/order')}?bid="+id;
    }
    //押金证明
    function prove(id) {
        layer.open({
            type:2,
            anim: 2,
            title:'上传押金证明',
            content:"{:url('index/postbusiness/prove')}?id="+id

        });
    }
    //显示全部
    function res() {
        window.location.href = "{:url('index/postbusiness/index')}";
    }
    //合作店
    function shop(id) {
        window.location.href = "{:url('index/postbusiness/shop')}?id="+id;
    }
    //结算记录
    function recordsettlement(id) {
        window.location.href = "{:url('index/postbusiness/recordsettlement')}?id="+id;
    }
    //申请结算
    function apply(bid) {
        window.location.href = "{:url('index/postbusiness/apply')}?bid="+bid;
    }
</script>
</html>